$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib')
require 'ext_pr1_v4'

#funktion zur bestimmung des minimums zweier werte
#min_int ::= (int1, int2) :: INT x INT => INT ::
#test( min_int(1,4) => 1, min_int(4,1) => 1, min_int(-5, 2) => -5,
#min_int(4,-5) => -5, min_int(-4,-5) => -4, min_int(-5,-4) => -4,
#min_int(4.0, 3) => Err, min_int(3, 4.0) => Err, min_int("hallo", 3) => Err,
#min_int(3, "hallo") => Err, min_int(3, 3) => Err)

def min_int(int1, int2)
  check_pre((
    int1.int? and
    int2.int? and
    int1 != int2
    ))
  
  (int1 > int2 ? int2 : int1)
end
#funktion zur bestimmung des maximums zweier werte
#max_int ::= (int1, int2) :: INT x INT => INT ::
#test(max_int(1,4) => 4, max_int(4,1) => 4, max_int(-5, 2) => 2,
#max_int(4,-5) => 4, max_int(-4,-5) => -4, max_int(-5,-4) => -4,
#max_int(4.0, 3) => Err, max_int(3, 4.0) => Err, max_int("hallo", 3) => Err,
#max_int(3, "hallo") => Err, max_int(3, 3) => Err)

def max_int(int1, int2)
  check_pre((
    int1.int? and
    int2.int? and
    int1 != int2
    ))
  
  (int1 < int2 ? int2 : int1)
end




